<?php
namespace app\api\controller;

use think\Controller;
use app\api\model\Refund;

class Refunds extends Controller
{

    /**
     * 用户申请退款
     */
    public function apply()
    {
        if (request()->isGet()){
            AjaxReturn('10020','传值方式错误');
            die;
        }
        if(request()->isPost()) {
            $info         =  [];
            $info['id']             =  input('id');
            $info['indentid'] =  input('indentid');
            $info['cause']      =  input('cause');
            $photo     =  request()->file('photo');
            $refund = new Refund();
            $data= $refund->apply($info,$photo);
            if($data == 1)
            {
                AjaxReturn('1','成功',['details'=>'退款申请成功']);
            }
            else
            {
                AjaxReturn('10034','退款申请失败');
            }
        }
    }




}